# -*- coding:utf-8 -*-
"""
作者：谷台阳
日期：2022年10月27日
"""
import cv2
import numpy as np
import time
import os

if __name__ == '__main__':
    os.mkdir("diff")
    start = time.perf_counter()
    for i in range(1, 9951):
        image_message = cv2.imread("../data/image_message/im{}.jpg".format(10000+i))
        image_original = cv2.imread("../data/image_original/im{}.jpg".format(10000+i))
        image_diff = cv2.absdiff(image_original, image_message)
        cv2.imwrite("diff/diff{}.jpg".format(10000+i), image_diff)
        # cv2.imshow("diff", image_diff)
        # cv2.waitKey(0)

        last = time.perf_counter() - start
        c = int(i / 9950 * 100)
        a = "*" * c
        b = "-" * (100 - c)
        print("\r{:^3.0f}%[{}->{}]{:.2f}s".format(c, a, b, last), end="")
